package router

import (
	"gforum/controller"
	"gforum/middlewares"
)

func setUpCommentsRouter() {
	postsByID := api.Group("/posts/:id")
	{
		postsByID.POST("/comments",
			middlewares.AuthRequired(), middlewares.PostCommentAllowed(),
			controller.PostComment)

		postsByID.GET("/comments", controller.GetAllCommentsByPostID)
	}

	commentsByID := api.Group("/comments/:id").Use(middlewares.AuthRequired())
	{
		commentsByID.PUT("/", controller.EditCommentByID)
		commentsByID.DELETE("/", controller.DelCommentByID)
	}
}
